<script type="text/javascript">
    $(document).ready(function(){
        $('.suggestion_search_area>li>ul>li>a').click(function(event){
            event.preventDefault();
            var conditions = '?';
            var currentCondition = $(this).attr('href').split('=')[0];
            $('.condition_set').each(function(){
                var type = $(this).attr('href').split('=')[0];
                if($(this).attr('href') != '' && currentCondition != type){
                    conditions += $(this).attr('href') + '&';
                }     
            });
            conditions += $(this).attr('href');
            window.location = conditions;
        });
    });
</script>

<div>
    <ul class="suggestion_search_area">
        <li>Tìm theo</li>
        <?php
            $aPriceCondition = $template->get('priceCondition');
        ?>
        <li><a href="<?php echo URL::getParam('gia',true,true);?>" class="condition_set"><?php echo (URL::getParam('gia') ? '<strong>'.$aPriceCondition[URL::getParam('gia')]['condition_name'].'</strong>' : 'Mức giá'); ?></a>
            <ul>
                <li><a href="gia=">Tất cả</a></li>
                <?php
                    if($template->get('priceCondition'))
                    {
                        foreach($template->get('priceCondition') as $condition)
                        {
                            echo '<li><a href="gia='.$condition['condition_id'].'">'.$condition['condition_name'].'</a></li>';
                        }
                    }
                ?>
            </ul>
        </li>
        <li><a href="<?php echo URL::getParam('diadiem',true,true);?>" class="condition_set"><?php echo (URL::getParam('diadiem') ? '<strong>'.URL::getParam('diadiem').'</strong>' : 'Địa điểm'); ?></a>
            <ul>
                <li><a href="diadiem=">Tất cả</a></li>
                <?php
                    if($template->get('locations'))
                    {
                        foreach($template->get('locations') as $aLocation)
                        {
                            echo '<li><a href="diadiem='.$aLocation['name'].'">'.$aLocation['name'].'</a></li>';
                        }
                    }
                ?>
            </ul>
        </li>
        <li><a href="<?php echo URL::getParam('hang',true,true);?>" class="condition_set"><?php echo (URL::getParam('hang') ? '<strong>'.URL::getParam('hang').'</strong>' : 'Hãng'); ?></a>
            <ul>
                <li><a href="hang=">Tất cả</a></li>
                <?php
                    if($template->get('aManufacturers'))
                    {
                        foreach($template->get('aManufacturers') as $aMenufacturer)
                        {
                            echo '<li><a href="hang='.$aMenufacturer['name'].'">'.$aMenufacturer['name'].'</a></li>';
                        }
                    }
                ?>
            </ul>
        </li>
    </ul>
</div>